import { createApp } from 'vue';
import Vant from 'vant';
import App from '@/App';
import HotUpdate from '@/utils/hotUpdate';
import { setupStore } from '@/stores';
import { setupI18n } from '@/locales';
import router, { setupRouter } from '@/router';
import Http from '@/utils/request';
import EventBus from '@/utils/eventBus';
import Scan from '@/components/baseComp/scan';
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import '@/utils/log';
import 'vant/lib/index.less';
import '@/assets/styles/app.scss';

const app = createApp(App).use(Vant);

setupI18n(app);
setupRouter(app);
setupStore(app);

app.config.globalProperties.$hotUpdate = new HotUpdate();
app.config.globalProperties.$http = new Http();
app.config.globalProperties.$log = window.console.log;
app.config.globalProperties.$eventBus = EventBus;
app.config.globalProperties.$scan = new Scan();

router.isReady().then(() => {
  app.mount('#app');
});

if (process.env.NODE_ENV === 'development') {
  app.config.performance = true;
  window.__APP__ = app;
}
